public class problem39 {
    public static void main(String[] args) {
        for (int p = 1; p <= 1000; p++) {
            int a = 1;
            int b = 1;

            do {
                do {
                    int c = ((Double)Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2))).intValue();
                    int perimeter = a + b + c;
                    if (p == perimeter) {
                        System.out.println(a + " " + b + " " + c);
                    }
                    b++;
                } while (b <= p);
                a++;
            } while (a <= p);
        }
    }
}
